import request from '@/utils/request'

export default {
  //获取所有分组信息
  getAllGroup() {
    return request({
      url: `/group/getAllGroup`,
      method: 'get'
    })
  },
  //获取分组信息，最终结果中的成员和志愿者以逗号分隔开
  getGroupInfoView(activityId) {
    return request({
      url: `/volunteerGroup/groupInfoView/${activityId}`,
      method: 'get'
    })
  },
  ////获取分组信息，最终结果中的成员和志愿者以集合形式展现
  groupInfo(activityId) {
    return request({
      url: `/volunteerGroup/groupInfo/${activityId}`,
      method: 'get'
    })
  },
  //分页展示组员和志愿者
  groupManageByPage(current, limit, groupQuery) {
    return request({
      url: `/volunteerGroup/groupManage/${current}/${limit}`,
      method: 'post',
      data: groupQuery
    })
  },
  //查询每个活动下的分组信息
  getActivityGroupInfo() {
    return request({
      url: `/volunteerGroup/activityGroupInfo`,
      method: 'get'
    })
  },
  //新增分组
  addGroup(groupInfo) {
    return request({
      url: `/group/addGroup`,
      method: 'post',
      data: groupInfo
    })
  },
  //更新分组
  updateGroup(groupInfo) {
    return request({
      url: `/group/updateGroup`,
      method: 'post',
      data: groupInfo
    })
  },
  //删除分组，及分组下的所有成员
  deleteGroup(groupId) {
    return request({
      url: `/group/deleteGroup/` + groupId,
      method: 'delete'
    })
  },
  //查询所有的角色
  getRoleList() {
    return request({
      url: `/volunteerGroup/getRoleList`,
      method: 'get'
    })
  },
  //根据id查询志愿者信息
  getVolunteerById(id) {
    return request({
      url: `/volunteer/getVolunteerById/${id}`,
      method: 'get'
    })
  },
  //查询没有分配被小组的人员
  getMemberNotInGroup() {
    return request({
      url: `/volunteer/getMemberNotInGroup`,
      method: 'get'
    })
  },
  //添加组员到小组（单个添加）
  addMemberIntoGroup(volunteerGroup) {
    return request({
      url: `/volunteerGroup/addMemberIntoGroup`,
      method: 'post',
      data: volunteerGroup
    })
  },
  //添加组员到小组（批量添加）
  addMemberListIntoGroup(memberList) {
    return request({
      url: `/volunteerGroup/addMemberListIntoGroup`,
      method: 'post',
      data: memberList
    })
  },
  //根据组id查询组内的成员
  getMemberByGroupId(groupId) {
    return request({
      url: `/volunteerGroup/getMemberByGroupId/${groupId}`,
      method: 'get'
    })
  },
  //将志愿者从小组中移除
  deleteVolunteerFromGroup(volunteerId){
    return request({
      url: `/volunteerGroup/deleteVolunteerFromGroup/${volunteerId}`,
      method: 'delete'
    })
  },
}
